/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufba.lasid.virt;

import br.ufba.lasid.base.IHost;
import java.util.List;

/**
 *
 * @author aliriosa
 */
public abstract class Xen implements IHypervisor {

    private String URI = "";
    private VirtualMachine virtualMachine = new VirtualMachine();
    private List<VirtualMachine> virtualMachines;
    protected IHost host = new Host();

    @Override
    public VirtualMachine getVirtualMachine() {
        return virtualMachine;
    }

    public void setVirtualMachine(VirtualMachine virtualMachine) {
        this.virtualMachine = virtualMachine;
    }

    @Override
    public List<VirtualMachine> getVirtualMachines() {
        return virtualMachines;
    }

    @Override
    public void setVirtualMachines(List<VirtualMachine> virtualMachines) {
        this.virtualMachines = virtualMachines;
    }

    @Override
    public String getURI() {
        return URI;
    }

    @Override
    public void setURI(String URI) {
        this.URI = URI;
    }

    public void setHost(IHost host) {
        this.host = host;
    }

    public IHost getHost() {
        return host;
    }

    public abstract void connect();

    public abstract int disconnect();

    @Override
    public void startup(String virtualMachineID) throws HypervisorException {
        throw new HypervisorException();
    }

    @Override
    public void shutdown(String virtualMachineID) throws HypervisorException {
        throw new HypervisorException();
    }

    public abstract void migrate(int idToMigrate, String locationURI);

    public abstract VirtualMachine newVMInstanceFromXMLFile(String xmlFile);

    public abstract VirtualMachine newVMInstance(String xmlString);

    public abstract void destroyVMInstance(String vmInstance);

    public abstract void destroyVMInstance(VirtualMachine virtualMachine);
}
